this.menu.addMenuItem(this._item);
this._syncId = 0;
+ this._adapter = null;
this._client = new GnomeBluetooth.Client();
this._model = this._client.get_model();
this._sync();
}
+ _setHadSetupDevices(value) {
+ if (this._hadSetupDevices === value)
+ return;
+
+ this._hadSetupDevices = value;
+ global.settings.set_boolean(
+ HAD_BLUETOOTH_DEVICES_SETUP, this._hadSetupDevices);
+ }
+
_getDefaultAdapter() {
let [ret, iter] = this._model.get_iter_first();
while (ret) {
ret = this._model.iter_next(iter);
}
- if (this._hadSetupDevices !== (deviceInfos.length > 0)) {
- this._hadSetupDevices = !this._hadSetupDevices;
- global.settings.set_boolean(HAD_BLUETOOTH_DEVICES_SETUP, this._hadSetupDevices);
- }
-
return deviceInfos;
}
const connectedDevices = devices.filter(dev => dev.connected);
const nConnectedDevices = connectedDevices.length;
+ if (adapter && this._adapter)
+ this._setHadSetupDevices(devices.length > 0);
+ this._adapter = adapter;
+
let sensitive = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
this.menu.setSensitive(sensitive);